package io.xccit.order.config;

import feign.Logger;
import feign.RetryableException;
import feign.Retryer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author CH_ywx
 * @version 1.0
 * @create 2025/5/17
 * <p>远程调用配置</p>
 */
@Configuration
public class RemoteConfig {


    /**
     * RestTemplate配置
     * @return
     */
    @LoadBalanced //注解式负载均衡,不加则没有负载均衡功能
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    /**
     * feign日志级别
     * @return
     */
    @Bean
    public Logger.Level  feignLoggerLevel(){
        return Logger.Level.FULL;
    }

    /**
     * feign重试机制
     * @return
     */
//    @Bean
//    public Retryer retryer(){
//        return new Retryer.Default();
//    }
}
